package study1;

public class MethodTest {
    public static void main(String[] args) {
        int[] arr1 = {23,112,22,75,32};
        int[] arr2 = new int[arr1.length];

        printf(arr1);
        printf(arr2);

        copy(arr1,arr2);
        printf(arr1);
        printf(arr2);

    }









    private static int Max(int[] arr) {
        int max=arr[0];
        for (int i = 1; i < arr.length ; i++) {
            if (arr[i]>max){
                max=arr[i];
            }
        }
        return max;

    }

    private static int Min(int[] arr) {
        int min=arr[0];
        for (int i = 1; i < arr.length ; i++) {
            if (arr[i]<min){
                min=arr[i];
            }
        }
        return min;
    }


    private static int sum(int[] arr) {
        int sum=0;
        for (int i = 0; i < arr.length; i++) {
            sum+=arr[i];
        }
        return sum;


    }


    private static void printf(int[] arr) {
        System.out.print("[");
        for (int i = 0; i < arr.length; i++) {
            System.out.print(i== arr.length-1?arr[i]:arr[i]+",");

        }
        System.out.print("]");
        System.out.println();
    }

    private static void copy(int[] arr,int[] arr2) {
        for (int i = 0; i < arr.length; i++) {
            arr2[i]=arr[i];
        }


    }

}
